﻿<phone:PhoneApplicationPage
    x:Class="Ch9RSS_WP8.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:convert="clr-namespace:Ch9RSS_WP8.Converters"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <phone:PhoneApplicationPage.Resources>
        <convert:ThumbConverter x:Key="ThumbConverter" />
        <DataTemplate x:Key="FeaturedItemsTemplate" >
            <Grid Margin="5,10,5,10" Height="225" >
                <Border x:Name="parentBorder" Background="{StaticResource PhoneAccentBrush}" >
                    <Image Source="{Binding thumbnail, Converter={StaticResource ThumbConverter}}" 
                                   Stretch="UniformToFill" 
                                   />
                </Border>
                <StackPanel VerticalAlignment="Bottom" Margin="0,0,0,0" Background="#CCF97600">
                    <TextBlock Text="{Binding title}" Foreground="White"  TextWrapping="Wrap" Margin="10,5,5,10" FontSize="16" />
                </StackPanel>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="StandardItemsTemplate" >
            <Grid Margin="10,10,20,10"  Height="225"
                 >
                <!-- 
                  Height="{StaticResource standardTargetHeight}"
                  Width="{StaticResource standardTargetWidth}" -->
                <Border x:Name="parentBorder" 
                            Background="{StaticResource PhoneAccentBrush}" 
                            BorderThickness="2" BorderBrush="#FF2C2C2C">
                    <Image Source="{Binding thumbnail, Converter={StaticResource ThumbConverter}}" 
                                   Stretch="UniformToFill" 
                                   />
                </Border>
                <!--StackPanel VerticalAlignment="Bottom" Margin="0,0,0,0" Background="#CCF97600">
                    <TextBlock Text="{Binding title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="Wrap" MaxLines="3" Margin="5,5,5,10" FontSize="16" />
                </-->
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" 
          Background="White" Loaded="TestGridLoaded"
          >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Height="50" VerticalAlignment="Top" Background="{StaticResource Ch9Orange}"  >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border >
                <Image Margin="10,5,0,5" HorizontalAlignment="Left" Source="/Assets/Ch9Logo.png" />
            </Border>
            <TextBlock Grid.Column="1" 
                       Text="Channel 9 Viewer" 
                       Foreground="White"
                       VerticalAlignment="Center"
                       Margin="10,0,0,0" FontSize="36" FontFamily="Global User Interface"/>
        </Grid>
        <phone:Pivot Foreground="#161616" Grid.Row="1" >
            <phone:PivotItem Header="Featured" >
                <phone:LongListSelector
                    ItemsSource="{Binding FeaturedItems}"
                    SelectionChanged="FeaturedItem_Changed"
                    ItemTemplate="{StaticResource FeaturedItemsTemplate}" />
            </phone:PivotItem>
            <phone:PivotItem Header="Shows" >
                <phone:LongListSelector
                   ItemsSource="{Binding ShowItems}"
                        SelectionChanged="ShowItem_Changed"
                        ItemTemplate="{StaticResource StandardItemsTemplate}" />
            </phone:PivotItem>
            <phone:PivotItem Header="Series" >
                <phone:LongListSelector
                    ItemsSource="{Binding SeriesItems}"
                    SelectionChanged="SeriesItem_Changed"
                    ItemTemplate="{StaticResource StandardItemsTemplate}"/>
            </phone:PivotItem>
            <phone:PivotItem Header="Recent" >
                <phone:LongListSelector
                    ItemsSource="{Binding RecentlyViewed}"
                    SelectionChanged="FeaturedItem_Changed"
                    ItemTemplate="{StaticResource StandardItemsTemplate}" />
            </phone:PivotItem>
        </phone:Pivot>

    </Grid>

</phone:PhoneApplicationPage>